package com.shopping_assistant.model;

import java.util.Comparator;

public class VisitedShopType {

	private Person person;
	
	private ShopType shopType;
	
	private int typeVisitedCounter;

	public VisitedShopType(Person person, ShopType shopType) {
		super();
		
		this.person = person;
		this.shopType = shopType;
		this.typeVisitedCounter = 0;
	}
	
	public Person getPerson() {
		return person;
	}

	public ShopType getShopType() {
		return shopType;
	}

	public int getTypeVisitedCounter() {
		return typeVisitedCounter;
	}
	
	public void setCount(int count) {
		typeVisitedCounter = count;
	}

	public static class CompareByCount implements Comparator<VisitedShopType> {

		public int compare(VisitedShopType lhs, VisitedShopType rhs) {
			return rhs.typeVisitedCounter - lhs.typeVisitedCounter;
		}
		
	}

	public void countVisit() {
		typeVisitedCounter++;
	}
	
	@Override
	public String toString() {
		return getShopType() + " [" + getTypeVisitedCounter() + "]";
	}
}
